/*
 * @Descripttion: 单据页面按钮权限
 * @version: V1.0
 * @Author: GaoWei
 * @Date: 2021-06-01 09:18:12
 * @LastEditors: GW
 * @LastEditTime: 2022-01-03 12:06:59
 */

const btnPermissionsFun = (path) => {
    let btnFront = null;
    switch (path) {
        case '/sale/saleQuotation':
            //报价单
            btnFront = 'saleQuotation'
            break;
        case '/sale/saleOrder':
            //销售订单
            btnFront = 'saleOrder'
            break;
        case '/sale/sampleOrder':
            //样品订单
            btnFront = 'sampleOrder'
            break;
        case '/sale/areaCalculation':
            //面积计算表
            btnFront = 'areaCalculation'
            break;
        case '/sale/areaCalculationPay':
            //面积计算表报价
            btnFront = 'areaCalculationPay'
            break;
        case '/sale/areaCalculationInOut':
            //面积计算表出入库情况
            btnFront = 'areaCalculationInOut'
            break;
        case '/sale/saleDelivery':
            //销售发货单
            btnFront = 'saleDelivery'
            break;
        case '/sale/saleXXYDelivery':
            //销售发货单(新西亚项目)
            btnFront = 'saleXXYDelivery'
            break;
        case '/sale/saleOut':
            //销售出库单
            btnFront = 'saleOutWarehouse'
            break;
        case '/sale/saleReturn':
            //退货通知单
            btnFront = 'saleReturn'
            break;
        case '/sale/saleOutRet':
            //销售退货单
            btnFront = 'saleOutRet'
            break;
        case '/sale/saleInvoice':
            //销售发票
            btnFront = 'saleInvoice'
            break;
        case '/procurement/purchaseRequisition':
            //请购单
            btnFront = 'ProcurementRequisition'
            break;
        case '/procurement/purchaseOrder':
            //采购订单
            btnFront = 'ProcurementOrder'
            break;
        case '/procurement/purchaseReceipt':
            //采购到货单
            btnFront = 'ProcurementReceipt'
            break;
        case '/procurement/purchaseReturn':
            //未入库退货单
            btnFront = 'ProcurementReturn'
            break;
        case '/procurement/purchaseExamineReturn':
            //已入库退货单
            btnFront = 'purchaseExamineReturn'
            break;
        case '/procurement/purchaseIn':
            //采购入库单
            btnFront = 'ProcurementPurchaseIn'
            break;
        case '/procurement/purchaseInvoice':
            //采购发票
            btnFront = 'ProcurementInvoice'
            break;


        //库存管理--------------------------------------------------
        case '/inventory/bills/purchaseIn':
            //采购入库单（库存管理）
            btnFront = 'purchaseIn'
            break;
        case '/inventory/bills/purchaseReturn':
            //采购退货单（库存管理）
            btnFront = 'purchaseReturn'
            break;
        case '/inventory/bills/productIn':
            //成品入库单（库存管理）
            btnFront = 'productIn'
            break;
        case '/inventory/bills/productOut':
            //成品退库单（库存管理）
            btnFront = 'productOut'
            break;
        case '/inventory/bills/delegateIn':
            //委外入库单（库存管理）
            btnFront = 'delegateIn'
            break;
        case '/inventory/bills/delegateOuta':
            //委外退库单（库存管理）
            btnFront = 'delegateOuta'
            break;
        case '/inventory/bills/otherIn':
            //其他入库单（库存管理）
            btnFront = 'otherIn'
            break;
        case '/inventory/bills/saleDelivery':
            //发货通知单（库存管理）
            btnFront = 'saleDeliveryWarehouse'
            break;
        case '/inventory/bills/saleReturn':
            //退货通知单（库存管理）
            btnFront = 'billSaleReturn'
            break;
        case '/inventory/bills/saleOut':
            //销售出库单（库存管理）
            btnFront = 'saleOut'
            break;
        case '/inventory/bills/saleOutRet':
            //销售退货单（库存管理）
            btnFront = 'billSaleOutRet'
            break;
        case '/inventory/bills/materialOut':
            //材料出库单（库存管理）
            btnFront = 'materialOut'
            break;
        case '/inventory/bills/materialOutRet':
            //材料退料单（库存管理）
            btnFront = 'materialOutRet'
            break;
        case '/inventory/bills/delegatePicking':
            //委外领料单（库存管理）
            btnFront = 'delegatePicking'
            break;
        case '/inventory/bills/delegateOutRet':
            //委外退料单（库存管理）
            btnFront = 'delegateOutRet'
            break;
        case '/inventory/bills/delegateOut':
            //委外出库单（库存管理）
            btnFront = 'delegateOut'
            break;

        case '/inventory/bills/otherOut':
            //其他出库单（库存管理）
            btnFront = 'otherOut'
            break;

        case '/inventory/transfers/applyTransfers':
            //调拨申请单（调拨业务）
            btnFront = 'applyTransfers'
            break;
        case '/inventory/transfers/transfers':
            //调拨单（调拨业务）
            btnFront = 'transfers'
            break;

        //生产管理--------------------------------------------------
        case '/production/productionWork':
            //加工单
            btnFront = 'productionWork'
            break;
        case '/production/productionProcessCard':
            //派工单
            btnFront = 'productionProcessCard'
            break;
        case '/production/productionProcessReport':
            //工序汇报单
            btnFront = 'productionProcessReport'
            break;
        case '/production/management/productionFinish':
            //生产完工单
            btnFront = 'productionFinish'
            break;
        case '/production/management/productionPicking':
            //生产领料单
            btnFront = 'productionPicking'
            break;
        case '/production/management/productionReturn':
            //生产退料单
            btnFront = 'productionReturn'
            break;
        case '/production/management/productionScattered':
            //零星领料单
            btnFront = 'productionScattered'
            break;
        case '/production/management/productionFillup':
            //生产补料单
            btnFront = 'productionFillup'
            break;
        case '/production/management/productionIn':
            //成品入库单
            btnFront = 'productionIn'
            break;
        case '/production/management/productOut':
            //成品退库单
            btnFront = 'productOutP'
            break;
            
        case '/production/productionPlan':
            //主生产计划
            btnFront = 'productionPlan'
            break;
        case '/production/management/productionOrder':
            //生产订单
            btnFront = 'productionOrder'
            break;
        case '/inventory/bills/picking':
            //领料单
            btnFront = 'picking'
            break;
        case '/outsource/outProductionWork':
            //委外加工单
            btnFront = 'outProductionWork'
            break;
        case '/outsource/outPicking':
            //委外领料单
            btnFront = 'outPicking'
            break;
        case '/outsource/outReturn':
            //委外退料单
            btnFront = 'outReturn'
            break;
        case '/outsource/outFillup':
            //委外超料领料单
            btnFront = 'outFillup'
            break;
        case '/outsource/outWarehouseIn':
            //委外入库单
            btnFront = 'outWarehouseIn'
            break;
        case '/outsource/delegateOutBack':
            //委外退库单
            btnFront = 'delegateOutBack'
            break;
        case '/outsource/outReceipt':
            //委外到货
            btnFront = 'outReceipt'
            break;
        case '/outsource/outInvoice':
            //委外发票
            btnFront = 'outInvoice'
            break;
        case '/outsource/outWarehouseOut':
            //委外出库单
            btnFront = 'outWarehouseOut'
            break;



        //财务会计--------------------------------------------------
        case '/finance/receiveManagement/receivableVoucher':
            //销售应收单（财务会计）
            btnFront = 'FReceivable'
            break;
        case '/finance/receiveManagement/receivOtherVoucher':
            //其他应收单（财务会计）
            btnFront = 'FOtherReceivable'
            break;
        case '/finance/receiveManagement/receiveVoucher':
            //收款单（财务会计）
            btnFront = 'FOtherReceive'
            break;
        case '/finance/paymentManagement/payableVoucher':
            //采购应付款单（财务会计）
            btnFront = 'FPayable'
            break;
        case '/finance/paymentManagement/payOtherVoucher':
            //其他应付款单（财务会计）
            btnFront = 'FOtherPay'
            break;
        case '/finance/paymentManagement/paymentVoucher':
            //付款单（财务会计）
            btnFront = 'FPayment'
            break;
        case '/finance/receiveManagement/initReceiveVoucher':
            //期初应收单（财务会计）
            btnFront = 'FInitReceivable'
            break;
        case '/finance/receiveManagement/initReceivOtherVoucher':
            //期初其他应收单（财务会计）
            btnFront = 'FInitOtherReceivable'
            break;
        case '/finance/receiveManagement/initReceivableVoucher':
            //期初收款单（财务会计）
            btnFront = 'FInitReceive'
            break;

        case '/finance/paymentManagement/initPayableVoucher':
            //期初应付单（财务会计）
            btnFront = 'FInitPayable'
            break;
        case '/finance/paymentManagement/initPayOtherVoucher':
            //期初其他应付单（财务会计）
            btnFront = 'FInitOtherPayable'
            break;
        case '/finance/paymentManagement/initPaymentVoucher':
            //期初付款单（财务会计）
            btnFront = 'FInitPayment'
            break;


        //质量管理--------------------------------------------------
        case '/quality/qualityDetection':
            //质检单
            btnFront = 'qualityDetection'
            break;

        //生产设置 --------------------------------------------------
        case '/production/procedurePrice':
            //工价维护
            btnFront = 'ProcedurePrice'
            break;

        //合同管理--------------------------------------------------
        case '/contract/contractBills':
            //合同签订
            btnFront = 'contractBills'
            break;
        case '/contract/contractBillsChange':
            //合同变更
            btnFront = 'contractBillsChange'
            break;
        case '/unit/setting/financeClient':
            //供应链--客户档案
            btnFront = 'customer'
            break;
        case '/production/productionDemand':
            //供应链--客户档案
            btnFront = 'productionPlan'
            break;
            
        default:
            break;
    }
    return btnFront;
}

/**
 * @name: 按钮的权限控制
 * @msg:
 * @param parameter.permissionAll 用户所有权限集合
 * @param parameter.path 页面路径(用于获取按钮权限前半段标识)
 * @param parameter.behind 权限后半段标识
 * @return {*}
*/

export default {
    btnPermission (parameter) {
        let isShow = false;
        let all = parameter.permissionAll;
        let btnFront = btnPermissionsFun(parameter.path);
        isShow = all.includes(btnFront + ':' + parameter.behind);
        return isShow;
    }
}

